<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
        jcTo(4)  return 4 * jcTo(3)=6;
        jcTo(3)  return 3 * jcTo(2)=2;
        jcTo(2)  return 2 * jcTo(1)=1;
        jcTo(1)  return 1;
      */
      function jcTo(n) {
        if (n === 1) return 1;
        return n * jcTo(n - 1);
      }
      console.log(jcTo(4)); //24
    </script>
  </body>
</html>
